package com.teradyne.merlin2.ui.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.teradyne.merlin2.ui.client.resources.MerlinStyle;

public class QuoteMenuViewImpl extends Composite implements QuoteMenuView {

	private static QuoteMenuViewUiBinder uiBinder = GWT.create(QuoteMenuViewUiBinder.class);

	interface QuoteMenuViewUiBinder extends UiBinder<Widget, QuoteMenuViewImpl> {
	}

	@UiField
	Anchor ancQuoteList;

	@UiField
	Anchor ancQuoteEntry;

	@UiField
	Anchor ancQuoteHistory;

	private Presenter presenter;

	/**
	 * 
	 * @param merlinStyle
	 *            - inject by gin for ensuring that the Merlin Style was
	 *            initialized
	 */

	@Inject
	public QuoteMenuViewImpl(MerlinStyle merlinStyle) {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}

	@UiHandler("ancQuoteList")
	void onOrderListClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onQuoteListClicked();
		}
	}

	@UiHandler("ancQuoteEntry")
	void onOrderEntryClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onQuoteEntryClicked();
		}
	}

	@UiHandler("ancQuoteHistory")
	void onOrderHistoryClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onQuoteHistoryClicked();
		}
	}

	// @Override
	// public HasClickHandlers getHandlerQuoteList() {
	// return ancQuoteList;
	// }
	//
	// @Override
	// public HasClickHandlers getHandlerQuoteEntry() {
	// return ancQuoteEntry;
	// }
	//
	// @Override
	// public HasClickHandlers getHandlerQuoteHistory() {
	// return ancQuoteHistory;
	// }

}
